I am trying to learn how to use the cloud billing API and playing around with it's methods. I copied a code snippet in Java that shows how to use the updateBillingInfo method. I have a project in my cloud account, and it has a billing account associated with it, and I wanted to change it to a different billing account.
Here's what I tried:
String name = "projects/My project";
ProjectBillingInfo info = new ProjectBillingInfo();
info.setBillingAccountName("billingAccounts/$BILLING_ID");
Cloudbilling.Projects.UpdateBillingInfo request = cloudbillingService.projects().updateBillingInfo(name, info);
ProjectBillingInfo response = request.execute();
and my problem is that request.execute() (as well as the API browser explorer) throws an exception with code "500 - internal error encountered".
Am I not using it correctly? It was my understanding that after this, when I check my project in GCP, I should see my project listed to the new billing account. Help is much appreciated.
You are using an invalid Project ID, since GCP project IDs have no spaces in them. Note that Project IDs and Project names are different things. It needs to be the ID as seen here. The rest of your code snippet seems fine, just make sure you put the actual project ID like this: projects/your-project-id
Related
I'm working on a project to automate the steps in the Google Article Maintain data security after an employee leaves and have encountered trouble with automating the step Revoke Recovery Password Access. I'm following the documentation on the Google API Explorer for Updating Users and am performing an API request to the endpoint PUT https://admin.googleapis.com/admin/directory/v1/users/{userKey} with the following JSON as the body:
{
"recoveryEmail": null,
"recoveryPhone": null
}
I receive a 200 response code with no error but email and phone number remains.
If I try some dummy data (such as below) then the information updates fine:
{
"recoveryEmail": "joe#bloggs.com",
"recoveryPhone": "+1234567890"
}
I also tried:
{
"recoveryEmail": "",
"recoveryPhone": ""
}
Ideally I would like to clear the data rather than overwriting it with dummy values.
If you have a Google Workspace account, I think the problem may be related to propagation. I have tested it myself before, using the following, and it worked:
{
"recoveryEmail": "",
"recoveryPhone": ""
}
This Help Center article mentions that the changes on users can take some time to appear https://support.google.com/a/answer/7514107
I have just tested it again and it worked. I would suggest checking the user information in an incognito or private browser window, or wait up to 24-48 hours due to propagation time.
I am trying to figure out how to specify the dataset location in a BigQuery API query using v0.27 of the BigQuery API.
I have a dataset located in northamerica-northeast1 and the BigQuery API is returning 404 errors since this is not the default multi-regional location "US."
I am using the run_async_query method to execute my queries but based on documentation am unsure how to add a location to this field to make it location aware.
I have also tried to previously update my client instantiation like this:
def _get_client(self):
bigquery.Client.SCOPE = (
'https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/drive')
client = bigquery.Client.from_service_account_json(_KEY_FILE)
if self._params['bq_data_location'].strip():
client.location = self._params['bq_data_location']
return client
However, it does not appear that this is the correct way to inform the BigQuery API of a dataset location.
For additional context, in my SQL that I am passing to the BigQuery API, I am already specifying the PROJECT_ID.DATASET_ID.TABLE_ID, however, this does not seem to be sufficient to find regional data.
Furthermore, I am making this request from Google App Engine using the CRMint open source data flow platform.
Can you please help me with an example of how location can be added to the BigQuery API for v0.27 so that the API does not return 404?
Thank you!
From the code sample it seems you're likely talking about google-cloud-bigquery 0.27, which was released in Aug 2017 and predates location support (as well as many other features).
Your best bet is to update that dependency to something more recent.
I'm integrating application insights with my App service which has a WebJobs project, following these instructions.
Things are working smoothly except that the cloud_RoleName and cloud_RoleInstanceName in ai portal are not meaningful (random numeric values, and seem to be changing over time).
I used a custom TelemetryInitializer in the api role, and it is changing those values as desired. However the webjob project doesn't seem to be picking up the role names assigned in custom initializer. When debugging locally, the code does execute the custom initializer overriden values, but it seems that it is being changed when the log is being sent to ai.
Here is the custom initializer that I use:
public class AppInsightsTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
telemetry.Context.Cloud.RoleName = ConfigurationManager.AppSettings["EnvironmentName"];
telemetry.Context.Cloud.RoleInstance = $"webjob-{ConfigurationManager.AppSettings["InstanceId"]}";
}
}
And it's hooked in WebJobs' Program.cs:
...
ApplicationInsights.Extensibility.TelemetryConfiguration.Active.TelemetryInitializers.Add(new AppInsightsTelemetryInitializer());
...
Could someone help me with this?
Thanks,
However the webjob project doesn't seem to be picking up the role names assigned in custom initializer.Could someone help me with this?
It should work correctly integration Azure Webjob, I test it on my side. Please have a try to get the log with Application Insight Analytics.
I am completely new to Amazon Web Services, however, I did get an account and I am able to browse our list of servers. I am trying to create a database backup programmatically using .NET. I have installed AWS for .NET and I have built and run the sample Empty console program.
I can see that I can create an instance of the RDS service with the following line:
AmazonRDS rds = AWSClientFactory.CreateAmazonRDSClient(RegionEndPoint.USEast1);
However, I notice that the rds.CreateDBSnapshot(); needs a request object but I don't see anything like CreateDBSnapshotRequest in the reference .dll, can anyone help with a working example?
Like you said CreateDBSnapshotRequest is the parameter you have to pass to this function.
CreateDBSnapshotRequest is defined in the Amazon.RDS.Model namespace within the AWSSDK.dll assembly (version 1.5.25.0)
Within CreateDBSnapshotRequest you must pass the the DB Instance Identifier (for example mydbinstance-1), that you defined when you invoked the CreateDBInstance (or one of it's related methods) and the identifier for the snapshot you wish to generate (example: my-snapshot-id) for this DB Instance.
edit / example
Well there are a couple ways to achieve this, here's one example - hope it clears up your doubts
using Amazon.RDS;
using Amazon.RDS.Model;
...
...
//gets the credentials from the default configuration
AmazonRDS rdsClient = AWSClientFactory.CreateAmazonRDSClient();
CreateDBSnapshotRequest dbSnapshotRequest = new CreateDBSnapshotRequest();
dbSnapshotRequest.DBInstanceIdentifier = "my-oracle-instance";
dbSnapshotRequest.DBSnapshotIdentifier = "daily-snapshot";
rdsClient.CreateDBSnapshot(dbSnapshotRequest);
Dont't forget that the DB Instance (in the example my-oracle-instance) must exist (duh :) and must be in the available state, like this:
I have the following problem. I am using Reporting Services 2005 to create some report. I call method from my custom assembly and it works fine when my method is as follows:
public static string TestMethod() {
return "test"; }
However, when return "test"; is replaced by the code that calls third party web service, there is nothing returned to my RS report. I can't even log my exception to EventLog (probably because of security reasons).
I class is decorated by the following statement:
[System.Web.AspNetHostingPermission(SecurityAction.Assert, Level = System.Web.AspNetHostingPermissionLevel.Unrestricted)]
additionally, for the purpose of calling web service I've added the following in my custom assembly:
string serviceUri = "http://externallink/Default.asmx";
WebPermission p = new WebPermission(NetworkAccess.Accept, serviceUri);
p.Assert();
This does not help either. The error that is thrown in my custom assembly is as follows:
Request for the permission of type
'System.Net.WebPermission, System,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
failed
Can someone can please help me?
EDIT1:
I figured out that reporting services uses custom trust level called: RosettaSrv. Custom policy is set in rssrvpolicy.config. When I changed trust level to Full, everything works fine. However I don't want to specify full trust, just possibility to access custom web services, how can I do this?
you have to create your specific CodeGroup section in the CAS policy config file (as you mentioned) for RS, which tells it to grant that permission for your assembly.
Follow steps found in this MSDN article for details: http://support.microsoft.com/kb/842419